/**
app.js
 */
import React, {
	Component
} from 'react';
import {
	AppRegistry,
	StyleSheet,
	Text,
	View,
	Navigator,
	BackAndroid,
	ToastAndroid,
	Platform
} from 'react-native';

import {
	connect
} from 'react-redux'


import Com from './Com'
import Welcome from './Welcome'

class App extends Component {

	render() {
		//定义初始化页面
		let initName='Welcome';
		let	initComponent=Welcome;
		return(
			<Navigator
	            initialRoute={{ name: initName, component: initComponent }}
	            //配置场景
	            configureScene={
					//这个是页面之间跳转时候的动画，具体有哪些？可以看这个目录下，有源代码的: node_modules/react-native/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js
	                (route) => {
						if(route.name=='Welcome'){
							return Navigator.SceneConfigs.FadeAndroid
						}
						if(route.name=='Com'){
							return Navigator.SceneConfigs.FadeAndroid
						}
						if(route.name=="MessageCenter"){
							return Navigator.SceneConfigs.VerticalDownSwipeJump
						}

						return Navigator.SceneConfigs.FadeAndroid
					}
	            }
	            renderScene={
	                (route, navigator) =><route.component {...route.params} navigator={navigator} />
	            }
			/>
		)
	}
}

export default connect(state => {
	return {
		state
	}
})(App)
